/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lk.uom.theta.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PostPersist;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author Umesh Liyanage
 */
@Entity
@Table(name="H1N1_Incident")
public class H1N1Incident implements Serializable {
    private static final long serialVersionUID = 53533422321L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
       
    @Column(name="patient_name", length=100, nullable=false, unique=true)
    private String patientName;
    
    @Column(name="gender", length=5, nullable=false)
    private String gender;
        
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    @Column(name="reported_date", nullable=false)
    private Date reportedDate;
        
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    @Column(name="date_of_birth", nullable=false)
    private Date dateOfBirth;
        
    @Column(name="area", length=100, nullable=false)
    private String area;
    
    @Column(name="complaints", length=255)
    private String complaints;
    
    @Column(name="contact_history", length=255)
    private String contactHistory;
    
    @Column(name="travel_history", length=255)
    private String travelHistory;
    
    @Column(name="contact_information", length=255) // generic - mobile, address or anything
    private String contactInformation;
    
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getComplaints() {
        return complaints;
    }

    public void setComplaints(String complaints) {
        this.complaints = complaints;
    }

    public String getContactHistory() {
        return contactHistory;
    }

    public void setContactHistory(String contactHistory) {
        this.contactHistory = contactHistory;
    }

    public String getContactInformation() {
        return contactInformation;
    }

    public void setContactInformation(String contactInformation) {
        this.contactInformation = contactInformation;
    }

    public Date getDateOfBirth() {
        return dateOfBirth;
    }

    public void setDateOfBirth(Date dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getPatientName() {
        return patientName;
    }

    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }

    public Date getReportedDate() {
        return reportedDate;
    }

    public void setReportedDate(Date reportedDate) {
        this.reportedDate = reportedDate;
    }

    public String getTravelHistory() {
        return travelHistory;
    }

    public void setTravelHistory(String travelHistory) {
        this.travelHistory = travelHistory;
    }

    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof H1N1Incident)) {
            return false;
        }
        H1N1Incident other = (H1N1Incident) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "lk.uom.theta.epidemiology.H1N1_Epidemiology[ id=" + id + " ]";
    }
    
    @PrePersist
    private void prePersist() {
        this.reportedDate = new Date();       
    }
}
